package com.inspur.edp.common.expr.expresses.constant;


import com.inspur.edp.common.expr.Express;
import com.inspur.edp.common.expr.ExpressDSLGenerator;
import com.inspur.edp.common.expr.ast.ASTContext;
import com.inspur.edp.common.type.utils.TypeUtil;

/**
 * @author lizhaorui
 * @description TODO
 * @date 2024/12/17 10:21
 */
public class StaticFieldConstDSL implements ExpressDSLGenerator {


    @Override
    public String getKind() {
        return StaticFieldConstExpr.KIND;
    }

    @Override
    public String generate(ASTContext context, Express express) {
        StaticFieldConstExpr staticFieldConstExpr = (StaticFieldConstExpr) express;
        context.addImport(staticFieldConstExpr.getDslType());
        String typeName = TypeUtil.getTypeCode(staticFieldConstExpr.getDslType());
        return String.format("%s.%s", typeName, staticFieldConstExpr.getFieldCode());
    }
}